/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.apps.utils;

import com.apps.beans.SettingsBean;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

/**
 *
 * @author ARIJIT PAL
 */
public class SystemProperties {

    private static Properties properties;

    public static void loadProperties(){
        properties = new Properties();
        try {
            properties.load(new FileInputStream("config.ini"));
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    public static void saveProperties(){
        try {
            properties.store(new FileOutputStream("config.ini"), null);
            loadProperties();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    public static String getProperties(String key, String def){
        if(properties == null)
            loadProperties();
        return properties.getProperty(key, def);
    }
    public static void setProperties(String key, String value){
        if(properties == null)
            loadProperties();
        properties.setProperty(key, value);
    }
    
}
